﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using BesAsm.MasterData.Entities;
using BesAsm.MasterData.Data;

#endregion

namespace BesAsm.MasterData.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="SpecialLinkProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class SpecialLinkProviderBaseCore : EntityProviderBase<BesAsm.MasterData.Entities.SpecialLink, BesAsm.MasterData.Entities.SpecialLinkKey>
	{		
		#region Get from Many To Many Relationship Functions
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, BesAsm.MasterData.Entities.SpecialLinkKey key)
		{
			return Delete(transactionManager, key.SpecialLinkId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_specialLinkId">Primary key, special link ID. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _specialLinkId)
		{
			return Delete(null, _specialLinkId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_specialLinkId">Primary key, special link ID. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _specialLinkId);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_LINKS key.
		///		FK_SPECIAL_LINKS_LINKS Description: 
		/// </summary>
		/// <param name="_toLinkId">Link Id along which the special link will be aligned.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByToLinkId(System.Int32? _toLinkId)
		{
			int count = -1;
			return GetByToLinkId(_toLinkId, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_LINKS key.
		///		FK_SPECIAL_LINKS_LINKS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_toLinkId">Link Id along which the special link will be aligned.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		/// <remarks></remarks>
		public TList<SpecialLink> GetByToLinkId(TransactionManager transactionManager, System.Int32? _toLinkId)
		{
			int count = -1;
			return GetByToLinkId(transactionManager, _toLinkId, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_LINKS key.
		///		FK_SPECIAL_LINKS_LINKS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_toLinkId">Link Id along which the special link will be aligned.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByToLinkId(TransactionManager transactionManager, System.Int32? _toLinkId, int start, int pageLength)
		{
			int count = -1;
			return GetByToLinkId(transactionManager, _toLinkId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_LINKS key.
		///		fkSpecialLinksLinks Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_toLinkId">Link Id along which the special link will be aligned.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByToLinkId(System.Int32? _toLinkId, int start, int pageLength)
		{
			int count =  -1;
			return GetByToLinkId(null, _toLinkId, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_LINKS key.
		///		fkSpecialLinksLinks Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_toLinkId">Link Id along which the special link will be aligned.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByToLinkId(System.Int32? _toLinkId, int start, int pageLength,out int count)
		{
			return GetByToLinkId(null, _toLinkId, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_LINKS key.
		///		FK_SPECIAL_LINKS_LINKS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_toLinkId">Link Id along which the special link will be aligned.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public abstract TList<SpecialLink> GetByToLinkId(TransactionManager transactionManager, System.Int32? _toLinkId, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_NODES key.
		///		FK_SPECIAL_LINKS_NODES Description: 
		/// </summary>
		/// <param name="_nodeId">Node from which the special link originates (upstream end)</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByNodeId(System.Int32? _nodeId)
		{
			int count = -1;
			return GetByNodeId(_nodeId, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_NODES key.
		///		FK_SPECIAL_LINKS_NODES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_nodeId">Node from which the special link originates (upstream end)</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		/// <remarks></remarks>
		public TList<SpecialLink> GetByNodeId(TransactionManager transactionManager, System.Int32? _nodeId)
		{
			int count = -1;
			return GetByNodeId(transactionManager, _nodeId, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_NODES key.
		///		FK_SPECIAL_LINKS_NODES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_nodeId">Node from which the special link originates (upstream end)</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByNodeId(TransactionManager transactionManager, System.Int32? _nodeId, int start, int pageLength)
		{
			int count = -1;
			return GetByNodeId(transactionManager, _nodeId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_NODES key.
		///		fkSpecialLinksNodes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_nodeId">Node from which the special link originates (upstream end)</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByNodeId(System.Int32? _nodeId, int start, int pageLength)
		{
			int count =  -1;
			return GetByNodeId(null, _nodeId, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_NODES key.
		///		fkSpecialLinksNodes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_nodeId">Node from which the special link originates (upstream end)</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByNodeId(System.Int32? _nodeId, int start, int pageLength,out int count)
		{
			return GetByNodeId(null, _nodeId, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_NODES key.
		///		FK_SPECIAL_LINKS_NODES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_nodeId">Node from which the special link originates (upstream end)</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public abstract TList<SpecialLink> GetByNodeId(TransactionManager transactionManager, System.Int32? _nodeId, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES key.
		///		FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES Description: 
		/// </summary>
		/// <param name="_specialLinkType">Foreign key to SPECIAL_LINK_TYPES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetBySpecialLinkType(System.String _specialLinkType)
		{
			int count = -1;
			return GetBySpecialLinkType(_specialLinkType, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES key.
		///		FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_specialLinkType">Foreign key to SPECIAL_LINK_TYPES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		/// <remarks></remarks>
		public TList<SpecialLink> GetBySpecialLinkType(TransactionManager transactionManager, System.String _specialLinkType)
		{
			int count = -1;
			return GetBySpecialLinkType(transactionManager, _specialLinkType, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES key.
		///		FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_specialLinkType">Foreign key to SPECIAL_LINK_TYPES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetBySpecialLinkType(TransactionManager transactionManager, System.String _specialLinkType, int start, int pageLength)
		{
			int count = -1;
			return GetBySpecialLinkType(transactionManager, _specialLinkType, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES key.
		///		fkSpecialLinksSpecialLinkTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_specialLinkType">Foreign key to SPECIAL_LINK_TYPES</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetBySpecialLinkType(System.String _specialLinkType, int start, int pageLength)
		{
			int count =  -1;
			return GetBySpecialLinkType(null, _specialLinkType, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES key.
		///		fkSpecialLinksSpecialLinkTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_specialLinkType">Foreign key to SPECIAL_LINK_TYPES</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetBySpecialLinkType(System.String _specialLinkType, int start, int pageLength,out int count)
		{
			return GetBySpecialLinkType(null, _specialLinkType, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES key.
		///		FK_SPECIAL_LINKS_SPECIAL_LINK_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_specialLinkType">Foreign key to SPECIAL_LINK_TYPES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public abstract TList<SpecialLink> GetBySpecialLinkType(TransactionManager transactionManager, System.String _specialLinkType, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_STATUSES key.
		///		FK_SPECIAL_LINKS_STATUSES Description: 
		/// </summary>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByStatus(System.String _status)
		{
			int count = -1;
			return GetByStatus(_status, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_STATUSES key.
		///		FK_SPECIAL_LINKS_STATUSES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		/// <remarks></remarks>
		public TList<SpecialLink> GetByStatus(TransactionManager transactionManager, System.String _status)
		{
			int count = -1;
			return GetByStatus(transactionManager, _status, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_STATUSES key.
		///		FK_SPECIAL_LINKS_STATUSES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByStatus(TransactionManager transactionManager, System.String _status, int start, int pageLength)
		{
			int count = -1;
			return GetByStatus(transactionManager, _status, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_STATUSES key.
		///		fkSpecialLinksStatuses Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByStatus(System.String _status, int start, int pageLength)
		{
			int count =  -1;
			return GetByStatus(null, _status, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_STATUSES key.
		///		fkSpecialLinksStatuses Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByStatus(System.String _status, int start, int pageLength,out int count)
		{
			return GetByStatus(null, _status, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_STATUSES key.
		///		FK_SPECIAL_LINKS_STATUSES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public abstract TList<SpecialLink> GetByStatus(TransactionManager transactionManager, System.String _status, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_TIME_FRAMES key.
		///		FK_SPECIAL_LINKS_TIME_FRAMES Description: 
		/// </summary>
		/// <param name="_timeFrame">Foreign key to TIME_FRAMES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByTimeFrame(System.String _timeFrame)
		{
			int count = -1;
			return GetByTimeFrame(_timeFrame, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_TIME_FRAMES key.
		///		FK_SPECIAL_LINKS_TIME_FRAMES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_timeFrame">Foreign key to TIME_FRAMES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		/// <remarks></remarks>
		public TList<SpecialLink> GetByTimeFrame(TransactionManager transactionManager, System.String _timeFrame)
		{
			int count = -1;
			return GetByTimeFrame(transactionManager, _timeFrame, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_TIME_FRAMES key.
		///		FK_SPECIAL_LINKS_TIME_FRAMES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_timeFrame">Foreign key to TIME_FRAMES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByTimeFrame(TransactionManager transactionManager, System.String _timeFrame, int start, int pageLength)
		{
			int count = -1;
			return GetByTimeFrame(transactionManager, _timeFrame, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_TIME_FRAMES key.
		///		fkSpecialLinksTimeFrames Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_timeFrame">Foreign key to TIME_FRAMES</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByTimeFrame(System.String _timeFrame, int start, int pageLength)
		{
			int count =  -1;
			return GetByTimeFrame(null, _timeFrame, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_TIME_FRAMES key.
		///		fkSpecialLinksTimeFrames Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_timeFrame">Foreign key to TIME_FRAMES</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public TList<SpecialLink> GetByTimeFrame(System.String _timeFrame, int start, int pageLength,out int count)
		{
			return GetByTimeFrame(null, _timeFrame, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_SPECIAL_LINKS_TIME_FRAMES key.
		///		FK_SPECIAL_LINKS_TIME_FRAMES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_timeFrame">Foreign key to TIME_FRAMES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.SpecialLink objects.</returns>
		public abstract TList<SpecialLink> GetByTimeFrame(TransactionManager transactionManager, System.String _timeFrame, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override BesAsm.MasterData.Entities.SpecialLink Get(TransactionManager transactionManager, BesAsm.MasterData.Entities.SpecialLinkKey key, int start, int pageLength)
		{
			return GetBySpecialLinkId(transactionManager, key.SpecialLinkId, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_SPECIAL_LINKS index.
		/// </summary>
		/// <param name="_specialLinkId">Primary key, special link ID</param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.SpecialLink"/> class.</returns>
		public BesAsm.MasterData.Entities.SpecialLink GetBySpecialLinkId(System.Int32 _specialLinkId)
		{
			int count = -1;
			return GetBySpecialLinkId(null,_specialLinkId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_SPECIAL_LINKS index.
		/// </summary>
		/// <param name="_specialLinkId">Primary key, special link ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.SpecialLink"/> class.</returns>
		public BesAsm.MasterData.Entities.SpecialLink GetBySpecialLinkId(System.Int32 _specialLinkId, int start, int pageLength)
		{
			int count = -1;
			return GetBySpecialLinkId(null, _specialLinkId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_SPECIAL_LINKS index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_specialLinkId">Primary key, special link ID</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.SpecialLink"/> class.</returns>
		public BesAsm.MasterData.Entities.SpecialLink GetBySpecialLinkId(TransactionManager transactionManager, System.Int32 _specialLinkId)
		{
			int count = -1;
			return GetBySpecialLinkId(transactionManager, _specialLinkId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_SPECIAL_LINKS index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_specialLinkId">Primary key, special link ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.SpecialLink"/> class.</returns>
		public BesAsm.MasterData.Entities.SpecialLink GetBySpecialLinkId(TransactionManager transactionManager, System.Int32 _specialLinkId, int start, int pageLength)
		{
			int count = -1;
			return GetBySpecialLinkId(transactionManager, _specialLinkId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_SPECIAL_LINKS index.
		/// </summary>
		/// <param name="_specialLinkId">Primary key, special link ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.SpecialLink"/> class.</returns>
		public BesAsm.MasterData.Entities.SpecialLink GetBySpecialLinkId(System.Int32 _specialLinkId, int start, int pageLength, out int count)
		{
			return GetBySpecialLinkId(null, _specialLinkId, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_SPECIAL_LINKS index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_specialLinkId">Primary key, special link ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.SpecialLink"/> class.</returns>
		public abstract BesAsm.MasterData.Entities.SpecialLink GetBySpecialLinkId(TransactionManager transactionManager, System.Int32 _specialLinkId, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;SpecialLink&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;SpecialLink&gt;"/></returns>
		public static TList<SpecialLink> Fill(IDataReader reader, TList<SpecialLink> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				BesAsm.MasterData.Entities.SpecialLink c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("SpecialLink")
					.Append("|").Append((System.Int32)reader[((int)SpecialLinkColumn.SpecialLinkId - 1)]).ToString();
					c = EntityManager.LocateOrCreate<SpecialLink>(
					key.ToString(), // EntityTrackingKey
					"SpecialLink",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new BesAsm.MasterData.Entities.SpecialLink();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.SpecialLinkId = (System.Int32)reader[((int)SpecialLinkColumn.SpecialLinkId - 1)];
					c.OriginalSpecialLinkId = c.SpecialLinkId;
					c.NodeId = (reader.IsDBNull(((int)SpecialLinkColumn.NodeId - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.NodeId - 1)];
					c.ToLinkId = (reader.IsDBNull(((int)SpecialLinkColumn.ToLinkId - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.ToLinkId - 1)];
					c.ToLinkIdIndex = (reader.IsDBNull(((int)SpecialLinkColumn.ToLinkIdIndex - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.ToLinkIdIndex - 1)];
					c.SpecialLinkType = (reader.IsDBNull(((int)SpecialLinkColumn.SpecialLinkType - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.SpecialLinkType - 1)];
					c.TimeFrame = (reader.IsDBNull(((int)SpecialLinkColumn.TimeFrame - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.TimeFrame - 1)];
					c.ValidFromDate = (reader.IsDBNull(((int)SpecialLinkColumn.ValidFromDate - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.ValidFromDate - 1)];
					c.ValidToDate = (reader.IsDBNull(((int)SpecialLinkColumn.ValidToDate - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.ValidToDate - 1)];
					c.SpecialLinkNodeModelId = (reader.IsDBNull(((int)SpecialLinkColumn.SpecialLinkNodeModelId - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.SpecialLinkNodeModelId - 1)];
					c.EditedBy = (System.String)reader[((int)SpecialLinkColumn.EditedBy - 1)];
					c.EditReason = (System.String)reader[((int)SpecialLinkColumn.EditReason - 1)];
					c.Status = (System.String)reader[((int)SpecialLinkColumn.Status - 1)];
					c.AppendDate = (System.DateTime)reader[((int)SpecialLinkColumn.AppendDate - 1)];
					c.EditDate = (reader.IsDBNull(((int)SpecialLinkColumn.EditDate - 1)))?null:(System.DateTime?)reader[((int)SpecialLinkColumn.EditDate - 1)];
					c.MspeclinkidDeprecated = (reader.IsDBNull(((int)SpecialLinkColumn.MspeclinkidDeprecated - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.MspeclinkidDeprecated - 1)];
					c.SlidDeprecated = (reader.IsDBNull(((int)SpecialLinkColumn.SlidDeprecated - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.SlidDeprecated - 1)];
					c.NodeDeprecated = (reader.IsDBNull(((int)SpecialLinkColumn.NodeDeprecated - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.NodeDeprecated - 1)];
					c.TomlinkidDeprecated = (reader.IsDBNull(((int)SpecialLinkColumn.TomlinkidDeprecated - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.TomlinkidDeprecated - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="BesAsm.MasterData.Entities.SpecialLink"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="BesAsm.MasterData.Entities.SpecialLink"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, BesAsm.MasterData.Entities.SpecialLink entity)
		{
			if (!reader.Read()) return;
			
			entity.SpecialLinkId = (System.Int32)reader[((int)SpecialLinkColumn.SpecialLinkId - 1)];
			entity.OriginalSpecialLinkId = (System.Int32)reader["special_link_id"];
			entity.NodeId = (reader.IsDBNull(((int)SpecialLinkColumn.NodeId - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.NodeId - 1)];
			entity.ToLinkId = (reader.IsDBNull(((int)SpecialLinkColumn.ToLinkId - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.ToLinkId - 1)];
			entity.ToLinkIdIndex = (reader.IsDBNull(((int)SpecialLinkColumn.ToLinkIdIndex - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.ToLinkIdIndex - 1)];
			entity.SpecialLinkType = (reader.IsDBNull(((int)SpecialLinkColumn.SpecialLinkType - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.SpecialLinkType - 1)];
			entity.TimeFrame = (reader.IsDBNull(((int)SpecialLinkColumn.TimeFrame - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.TimeFrame - 1)];
			entity.ValidFromDate = (reader.IsDBNull(((int)SpecialLinkColumn.ValidFromDate - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.ValidFromDate - 1)];
			entity.ValidToDate = (reader.IsDBNull(((int)SpecialLinkColumn.ValidToDate - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.ValidToDate - 1)];
			entity.SpecialLinkNodeModelId = (reader.IsDBNull(((int)SpecialLinkColumn.SpecialLinkNodeModelId - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.SpecialLinkNodeModelId - 1)];
			entity.EditedBy = (System.String)reader[((int)SpecialLinkColumn.EditedBy - 1)];
			entity.EditReason = (System.String)reader[((int)SpecialLinkColumn.EditReason - 1)];
			entity.Status = (System.String)reader[((int)SpecialLinkColumn.Status - 1)];
			entity.AppendDate = (System.DateTime)reader[((int)SpecialLinkColumn.AppendDate - 1)];
			entity.EditDate = (reader.IsDBNull(((int)SpecialLinkColumn.EditDate - 1)))?null:(System.DateTime?)reader[((int)SpecialLinkColumn.EditDate - 1)];
			entity.MspeclinkidDeprecated = (reader.IsDBNull(((int)SpecialLinkColumn.MspeclinkidDeprecated - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.MspeclinkidDeprecated - 1)];
			entity.SlidDeprecated = (reader.IsDBNull(((int)SpecialLinkColumn.SlidDeprecated - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.SlidDeprecated - 1)];
			entity.NodeDeprecated = (reader.IsDBNull(((int)SpecialLinkColumn.NodeDeprecated - 1)))?null:(System.String)reader[((int)SpecialLinkColumn.NodeDeprecated - 1)];
			entity.TomlinkidDeprecated = (reader.IsDBNull(((int)SpecialLinkColumn.TomlinkidDeprecated - 1)))?null:(System.Int32?)reader[((int)SpecialLinkColumn.TomlinkidDeprecated - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="BesAsm.MasterData.Entities.SpecialLink"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="BesAsm.MasterData.Entities.SpecialLink"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, BesAsm.MasterData.Entities.SpecialLink entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.SpecialLinkId = (System.Int32)dataRow["special_link_id"];
			entity.OriginalSpecialLinkId = (System.Int32)dataRow["special_link_id"];
			entity.NodeId = Convert.IsDBNull(dataRow["node_id"]) ? null : (System.Int32?)dataRow["node_id"];
			entity.ToLinkId = Convert.IsDBNull(dataRow["to_link_id"]) ? null : (System.Int32?)dataRow["to_link_id"];
			entity.ToLinkIdIndex = Convert.IsDBNull(dataRow["to_link_id_index"]) ? null : (System.Int32?)dataRow["to_link_id_index"];
			entity.SpecialLinkType = Convert.IsDBNull(dataRow["special_link_type"]) ? null : (System.String)dataRow["special_link_type"];
			entity.TimeFrame = Convert.IsDBNull(dataRow["time_frame"]) ? null : (System.String)dataRow["time_frame"];
			entity.ValidFromDate = Convert.IsDBNull(dataRow["valid_from_date"]) ? null : (System.String)dataRow["valid_from_date"];
			entity.ValidToDate = Convert.IsDBNull(dataRow["valid_to_date"]) ? null : (System.String)dataRow["valid_to_date"];
			entity.SpecialLinkNodeModelId = Convert.IsDBNull(dataRow["special_link_node_model_id"]) ? null : (System.String)dataRow["special_link_node_model_id"];
			entity.EditedBy = (System.String)dataRow["edited_by"];
			entity.EditReason = (System.String)dataRow["edit_reason"];
			entity.Status = (System.String)dataRow["status"];
			entity.AppendDate = (System.DateTime)dataRow["append_date"];
			entity.EditDate = Convert.IsDBNull(dataRow["edit_date"]) ? null : (System.DateTime?)dataRow["edit_date"];
			entity.MspeclinkidDeprecated = Convert.IsDBNull(dataRow["mspeclinkid_deprecated"]) ? null : (System.Int32?)dataRow["mspeclinkid_deprecated"];
			entity.SlidDeprecated = Convert.IsDBNull(dataRow["slid_deprecated"]) ? null : (System.Int32?)dataRow["slid_deprecated"];
			entity.NodeDeprecated = Convert.IsDBNull(dataRow["node_deprecated"]) ? null : (System.String)dataRow["node_deprecated"];
			entity.TomlinkidDeprecated = Convert.IsDBNull(dataRow["tomlinkid_deprecated"]) ? null : (System.Int32?)dataRow["tomlinkid_deprecated"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="BesAsm.MasterData.Entities.SpecialLink"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">BesAsm.MasterData.Entities.SpecialLink Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, BesAsm.MasterData.Entities.SpecialLink entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region ToLinkIdSource	
			if (CanDeepLoad(entity, "Link|ToLinkIdSource", deepLoadType, innerList) 
				&& entity.ToLinkIdSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.ToLinkId ?? (int)0);
				Link tmpEntity = EntityManager.LocateEntity<Link>(EntityLocator.ConstructKeyFromPkItems(typeof(Link), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.ToLinkIdSource = tmpEntity;
				else
					entity.ToLinkIdSource = DataRepository.LinkProvider.GetByLinkId(transactionManager, (entity.ToLinkId ?? (int)0));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'ToLinkIdSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.ToLinkIdSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.LinkProvider.DeepLoad(transactionManager, entity.ToLinkIdSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion ToLinkIdSource

			#region NodeIdSource	
			if (CanDeepLoad(entity, "Node|NodeIdSource", deepLoadType, innerList) 
				&& entity.NodeIdSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.NodeId ?? (int)0);
				Node tmpEntity = EntityManager.LocateEntity<Node>(EntityLocator.ConstructKeyFromPkItems(typeof(Node), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.NodeIdSource = tmpEntity;
				else
					entity.NodeIdSource = DataRepository.NodeProvider.GetByNodeId(transactionManager, (entity.NodeId ?? (int)0));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'NodeIdSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.NodeIdSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.NodeProvider.DeepLoad(transactionManager, entity.NodeIdSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion NodeIdSource

			#region SpecialLinkTypeSource	
			if (CanDeepLoad(entity, "SpecialLinkType|SpecialLinkTypeSource", deepLoadType, innerList) 
				&& entity.SpecialLinkTypeSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.SpecialLinkType ?? string.Empty);
				SpecialLinkType tmpEntity = EntityManager.LocateEntity<SpecialLinkType>(EntityLocator.ConstructKeyFromPkItems(typeof(SpecialLinkType), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.SpecialLinkTypeSource = tmpEntity;
				else
					entity.SpecialLinkTypeSource = DataRepository.SpecialLinkTypeProvider.GetBySpecialLinkTypeId(transactionManager, (entity.SpecialLinkType ?? string.Empty));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'SpecialLinkTypeSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.SpecialLinkTypeSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.SpecialLinkTypeProvider.DeepLoad(transactionManager, entity.SpecialLinkTypeSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion SpecialLinkTypeSource

			#region StatusSource	
			if (CanDeepLoad(entity, "Status|StatusSource", deepLoadType, innerList) 
				&& entity.StatusSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.Status;
				Status tmpEntity = EntityManager.LocateEntity<Status>(EntityLocator.ConstructKeyFromPkItems(typeof(Status), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.StatusSource = tmpEntity;
				else
					entity.StatusSource = DataRepository.StatusProvider.GetByStatusId(transactionManager, entity.Status);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'StatusSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.StatusSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.StatusProvider.DeepLoad(transactionManager, entity.StatusSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion StatusSource

			#region TimeFrameSource	
			if (CanDeepLoad(entity, "TimeFrame|TimeFrameSource", deepLoadType, innerList) 
				&& entity.TimeFrameSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.TimeFrame ?? string.Empty);
				TimeFrame tmpEntity = EntityManager.LocateEntity<TimeFrame>(EntityLocator.ConstructKeyFromPkItems(typeof(TimeFrame), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.TimeFrameSource = tmpEntity;
				else
					entity.TimeFrameSource = DataRepository.TimeFrameProvider.GetByTimeFrameId(transactionManager, (entity.TimeFrame ?? string.Empty));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'TimeFrameSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.TimeFrameSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.TimeFrameProvider.DeepLoad(transactionManager, entity.TimeFrameSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion TimeFrameSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetBySpecialLinkId methods when available
			
			#region SpecialLinkDatumCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<SpecialLinkDatum>|SpecialLinkDatumCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'SpecialLinkDatumCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.SpecialLinkDatumCollection = DataRepository.SpecialLinkDatumProvider.GetBySpecialLinkId(transactionManager, entity.SpecialLinkId);

				if (deep && entity.SpecialLinkDatumCollection.Count > 0)
				{
					deepHandles.Add("SpecialLinkDatumCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<SpecialLinkDatum>) DataRepository.SpecialLinkDatumProvider.DeepLoad,
						new object[] { transactionManager, entity.SpecialLinkDatumCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the BesAsm.MasterData.Entities.SpecialLink object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">BesAsm.MasterData.Entities.SpecialLink instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">BesAsm.MasterData.Entities.SpecialLink Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, BesAsm.MasterData.Entities.SpecialLink entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region ToLinkIdSource
			if (CanDeepSave(entity, "Link|ToLinkIdSource", deepSaveType, innerList) 
				&& entity.ToLinkIdSource != null)
			{
				DataRepository.LinkProvider.Save(transactionManager, entity.ToLinkIdSource);
				entity.ToLinkId = entity.ToLinkIdSource.LinkId;
			}
			#endregion 
			
			#region NodeIdSource
			if (CanDeepSave(entity, "Node|NodeIdSource", deepSaveType, innerList) 
				&& entity.NodeIdSource != null)
			{
				DataRepository.NodeProvider.Save(transactionManager, entity.NodeIdSource);
				entity.NodeId = entity.NodeIdSource.NodeId;
			}
			#endregion 
			
			#region SpecialLinkTypeSource
			if (CanDeepSave(entity, "SpecialLinkType|SpecialLinkTypeSource", deepSaveType, innerList) 
				&& entity.SpecialLinkTypeSource != null)
			{
				DataRepository.SpecialLinkTypeProvider.Save(transactionManager, entity.SpecialLinkTypeSource);
				entity.SpecialLinkType = entity.SpecialLinkTypeSource.SpecialLinkTypeId;
			}
			#endregion 
			
			#region StatusSource
			if (CanDeepSave(entity, "Status|StatusSource", deepSaveType, innerList) 
				&& entity.StatusSource != null)
			{
				DataRepository.StatusProvider.Save(transactionManager, entity.StatusSource);
				entity.Status = entity.StatusSource.StatusId;
			}
			#endregion 
			
			#region TimeFrameSource
			if (CanDeepSave(entity, "TimeFrame|TimeFrameSource", deepSaveType, innerList) 
				&& entity.TimeFrameSource != null)
			{
				DataRepository.TimeFrameProvider.Save(transactionManager, entity.TimeFrameSource);
				entity.TimeFrame = entity.TimeFrameSource.TimeFrameId;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
	
			#region List<SpecialLinkDatum>
				if (CanDeepSave(entity.SpecialLinkDatumCollection, "List<SpecialLinkDatum>|SpecialLinkDatumCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(SpecialLinkDatum child in entity.SpecialLinkDatumCollection)
					{
						if(child.SpecialLinkIdSource != null)
						{
							child.SpecialLinkId = child.SpecialLinkIdSource.SpecialLinkId;
						}
						else
						{
							child.SpecialLinkId = entity.SpecialLinkId;
						}

					}

					if (entity.SpecialLinkDatumCollection.Count > 0 || entity.SpecialLinkDatumCollection.DeletedItems.Count > 0)
					{
						//DataRepository.SpecialLinkDatumProvider.Save(transactionManager, entity.SpecialLinkDatumCollection);
						
						deepHandles.Add("SpecialLinkDatumCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< SpecialLinkDatum >) DataRepository.SpecialLinkDatumProvider.DeepSave,
							new object[] { transactionManager, entity.SpecialLinkDatumCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region SpecialLinkChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>BesAsm.MasterData.Entities.SpecialLink</c>
	///</summary>
	public enum SpecialLinkChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>Link</c> at ToLinkIdSource
		///</summary>
		[ChildEntityType(typeof(Link))]
		Link,
			
		///<summary>
		/// Composite Property for <c>Node</c> at NodeIdSource
		///</summary>
		[ChildEntityType(typeof(Node))]
		Node,
			
		///<summary>
		/// Composite Property for <c>SpecialLinkType</c> at SpecialLinkTypeSource
		///</summary>
		[ChildEntityType(typeof(SpecialLinkType))]
		SpecialLinkType,
			
		///<summary>
		/// Composite Property for <c>Status</c> at StatusSource
		///</summary>
		[ChildEntityType(typeof(Status))]
		Status,
			
		///<summary>
		/// Composite Property for <c>TimeFrame</c> at TimeFrameSource
		///</summary>
		[ChildEntityType(typeof(TimeFrame))]
		TimeFrame,
	
		///<summary>
		/// Collection of <c>SpecialLink</c> as OneToMany for SpecialLinkDatumCollection
		///</summary>
		[ChildEntityType(typeof(TList<SpecialLinkDatum>))]
		SpecialLinkDatumCollection,
	}
	
	#endregion SpecialLinkChildEntityTypes
	
	#region SpecialLinkFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;SpecialLinkColumn&gt;"/> class
	/// that is used exclusively with a <see cref="SpecialLink"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class SpecialLinkFilterBuilder : SqlFilterBuilder<SpecialLinkColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the SpecialLinkFilterBuilder class.
		/// </summary>
		public SpecialLinkFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the SpecialLinkFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public SpecialLinkFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the SpecialLinkFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public SpecialLinkFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion SpecialLinkFilterBuilder
	
	#region SpecialLinkParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;SpecialLinkColumn&gt;"/> class
	/// that is used exclusively with a <see cref="SpecialLink"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class SpecialLinkParameterBuilder : ParameterizedSqlFilterBuilder<SpecialLinkColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the SpecialLinkParameterBuilder class.
		/// </summary>
		public SpecialLinkParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the SpecialLinkParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public SpecialLinkParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the SpecialLinkParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public SpecialLinkParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion SpecialLinkParameterBuilder
	
	#region SpecialLinkSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;SpecialLinkColumn&gt;"/> class
	/// that is used exclusively with a <see cref="SpecialLink"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class SpecialLinkSortBuilder : SqlSortBuilder<SpecialLinkColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the SpecialLinkSqlSortBuilder class.
		/// </summary>
		public SpecialLinkSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion SpecialLinkSortBuilder
	
} // end namespace
